package com.example.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;

import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;

public class TestActivity extends AppCompatActivity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //去掉ActionBar
        ActionBar actionBar=getSupportActionBar();
        if(actionBar!=null){
            actionBar.hide();
        }
        setContentView(R.layout.testactivity_layout);
        //获取EditText实例
        EditText et1 = findViewById(R.id.et1);
        //关闭按钮的监听逻辑
        findViewById(R.id.close_bt).setOnClickListener(v->{
            Intent intent = new Intent();
            //获取到EditText输入框内容
            String inputContent = et1.getText().toString();
            intent.putExtra("data",inputContent);
            setResult(1000,intent);
            //关闭Activity
            finish();
        });

    }

    @Override
    protected void onStart() {
        super.onStart();



    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    protected void onRestart() {
        super.onRestart();
    }
}
